﻿using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace TuLing.Blazor.Migrations
{
    public partial class removeNavi23333 : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_BuyOrderDetails_BuyOrders_Id",
                table: "BuyOrderDetails");

            migrationBuilder.DropColumn(
                name: "CustomerId",
                table: "BuyOrders");

            migrationBuilder.AlterColumn<long>(
                name: "Id",
                table: "BuyOrderDetails",
                type: "INTEGER",
                nullable: false,
                oldClrType: typeof(long),
                oldType: "INTEGER")
                .Annotation("Sqlite:Autoincrement", true);

            migrationBuilder.CreateIndex(
                name: "IX_BuyOrderDetails_BuyOrderId",
                table: "BuyOrderDetails",
                column: "BuyOrderId");

            migrationBuilder.AddForeignKey(
                name: "FK_BuyOrderDetails_BuyOrders_BuyOrderId",
                table: "BuyOrderDetails",
                column: "BuyOrderId",
                principalTable: "BuyOrders",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_BuyOrderDetails_BuyOrders_BuyOrderId",
                table: "BuyOrderDetails");

            migrationBuilder.DropIndex(
                name: "IX_BuyOrderDetails_BuyOrderId",
                table: "BuyOrderDetails");

            migrationBuilder.AddColumn<long>(
                name: "CustomerId",
                table: "BuyOrders",
                type: "INTEGER",
                nullable: false,
                defaultValue: 0L);

            migrationBuilder.AlterColumn<long>(
                name: "Id",
                table: "BuyOrderDetails",
                type: "INTEGER",
                nullable: false,
                oldClrType: typeof(long),
                oldType: "INTEGER")
                .OldAnnotation("Sqlite:Autoincrement", true);

            migrationBuilder.AddForeignKey(
                name: "FK_BuyOrderDetails_BuyOrders_Id",
                table: "BuyOrderDetails",
                column: "Id",
                principalTable: "BuyOrders",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);
        }
    }
}
